<template>
  <PageContainer
    class="payDetail-page"
    backgroundColor="#0077FF"
    :showNavBar="false"
  >
    <view class="main-content">
      <view class="hero-section">
        <view class="phone-illustration">
          <view class="phone-mockup">
            <view class="phone-screen">
              <view class="screen-content">
                <view class="status-bar">
                  <view class="status-left">
                    <text class="time">14:59</text>
                  </view>
                  <view class="status-right">
                    <view class="signal"></view>
                    <view class="wifi"></view>
                    <view class="battery"></view>
                  </view>
                </view>

                <view class="app-grid">
                  <view class="app-row">
                    <view class="app-icon" v-for="i in 4" :key="'top-' + i">
                      <view
                        class="icon-bg"
                        :style="{ backgroundColor: getRandomColor() }"
                      ></view>
                    </view>
                  </view>
                  <view class="app-row">
                    <view class="app-icon" v-for="i in 4" :key="'mid-' + i">
                      <view
                        class="icon-bg"
                        :style="{ backgroundColor: getRandomColor() }"
                      ></view>
                    </view>
                  </view>
                </view>

                <view class="bottom-banner">
                  <image
                    src="/static/images/banner-placeholder.jpg"
                    class="banner-image"
                    mode="aspectFill"
                  ></image>
                </view>
              </view>
            </view>
          </view>
        </view>

        <view class="hero-text">
          <text class="main-title">KK钱包 充值秒到账</text>
          <text class="sub-title">安全无忧 零封控</text>
          <text class="description">支持网页版H5支付 无需下载APP</text>
        </view>
      </view>

      <view class="payment-area">
        <view class="payment-amount"
          >支付金额：
          {{
            BigNumber(orderDetail?.amount).dividedBy(1000000).toNumber()
          }}</view
        >
        <view class="qr-section" @tap="handleQRTap">
          <view class="qr-container">
            <up-qrcode
              cid="ex1"
              :size="200"
              :val="orderNo"
              :icon="logoImg"
            ></up-qrcode>
          </view>
        </view>

        <view class="payment-countdown">
          <text class="countdown-text">请在 </text>
          <text class="countdown-time" :class="{ urgent: remainingTime < 300 }">
            {{ formatCountdownTime(remainingTime) }}
          </text>
          <text class="countdown-text"> 之内完成支付</text>
        </view>

        <view class="action-buttons">
          <up-button
            type="primary"
            @click="handleWalletPayment"
            :loading="isProcessingPayment"
            :disabled="remainingTime <= 0"
            class="wallet-pay-btn"
            :class="{
              expired: remainingTime <= 0,
              processing: isProcessingPayment,
            }"
          >
            {{ getPaymentButtonText }}
          </up-button>

          <up-button
            type="primary"
            @click="handleDownloadWallet"
            :disabled="remainingTime <= 0"
            class="download-btn"
            :class="{ expired: remainingTime <= 0 }"
          >
            {{ remainingTime <= 0 ? "订单已过期" : "下载KK钱包" }}
          </up-button>
        </view>
      </view>

      <view class="customer-service">
        <text class="service-title" @click="openCustomerService"
          >KK在线客服</text
        >
        <!-- <text class="advantages-title">我们的优势</text>
        <text class="advantage-item"
          >1：无需抢单 输入任意金额 百分百秒出单</text
        >
        <text class="advantage-item"
          >2：我们提供游戏流水商城，方便跟银行解释流水去向。</text
        > -->
      </view>
    </view>

    <SnPopup
      v-model="showSuccessModal"
      mode="center"
      :round="16"
      :mask-close-able="false"
    >
      <view class="success-modal">
        <view class="success-animation">
          <view class="success-icon">
            <u-icon name="checkmark" size="50" color="#fff"></u-icon>
          </view>
          <view class="success-ripple"></view>
        </view>

        <text class="success-title">支付成功</text>
        <text class="success-desc">您的充值订单已完成处理</text>
        <text class="success-detail">金额将在1-3分钟内到账，请耐心等待</text>

        <view class="order-info">
          <view class="info-row">
            <text class="info-label">支付金额</text>
            <text class="info-value">{{
              BigNumber(orderDetail?.amount).dividedBy(1000000).toNumber()
            }}</text>
          </view>
          <view class="info-row">
            <text class="info-label">订单编号</text>
            <text class="info-value">{{ orderDetail?.order_no }}</text>
          </view>
          <view class="info-row">
            <text class="info-label">完成时间</text>
            <text class="info-value">{{ completedTime }}</text>
          </view>
        </view>

        <view class="modal-actions">
          <!-- <u-button @click="viewOrderDetail" class="detail-btn"
            >订单详情</u-button
          > -->
          <u-button type="primary" @click="closeSuccessModal" class="ok-btn"
            >确定</u-button
          >
        </view>
      </view>
    </SnPopup>

    <SnPopup
      v-model="showTimeoutModal"
      mode="center"
      width="80%"
      round="16"
      :mask-close-able="false"
    >
      <view class="timeout-modal">
        <view class="timeout-icon">
          <up-icon name="clock" size="64" color="#FF8C00"></up-icon>
        </view>

        <text class="timeout-title">支付超时</text>
        <text class="timeout-desc">很抱歉，您的支付时间已超时</text>
        <text class="timeout-detail">请重新发起支付或联系客服处理</text>

        <view class="timeout-actions">
          <u-button @click="goBackHome" class="back-btn">返回首页</u-button>
          <u-button type="primary" @click="restartPayment" class="retry-btn"
            >重新支付</u-button
          >
        </view>
      </view>
    </SnPopup>

    <SnPopup
      v-model="showDownloadModal"
      mode="bottom"
      height="65%"
      round="16"
      closeable
    >
      <view class="download-modal">
        <view class="download-header">
          <text class="download-title">下载KK钱包</text>
          <text class="download-subtitle">享受更快速、更安全的支付体验</text>
        </view>

        <view class="app-features">
          <view class="feature-item">
            <up-icon
              custom-prefix="iconfont"
              name="anquan-icon"
              size="24"
              color="#52C41A"
            ></up-icon>
            <text class="feature-text">银行级安全防护</text>
          </view>
          <view class="feature-item">
            <up-icon
              custom-prefix="iconfont"
              name="jishu-icon"
              size="24"
              color="#FF8C00"
            ></up-icon>
            <text class="feature-text">极速到账体验</text>
          </view>
          <view class="feature-item">
            <up-icon
              custom-prefix="iconfont"
              name="liwu-icon"
              size="24"
              color="#FF6B6B"
            ></up-icon>
            <text class="feature-text">新人专享优惠</text>
          </view>
        </view>

        <view class="download-platforms">
          <view class="platform-option" @click="downloadForAndroid">
            <view class="platform-icon">
              <up-icon name="android-fill" size="32" color="#52C41A"></up-icon>
            </view>
            <view class="platform-info">
              <text class="platform-name">Android版本</text>
              <text class="platform-desc">支持Android 6.0+</text>
            </view>
            <up-icon name="arrow-right" size="16" color="#ccc"></up-icon>
          </view>

          <view class="platform-option" @click="downloadForIOS">
            <view class="platform-icon">
              <up-icon name="apple-fill" size="32" color="#333"></up-icon>
            </view>
            <view class="platform-info">
              <text class="platform-name">iOS版本</text>
              <text class="platform-desc">支持iOS 12.0+</text>
            </view>
            <up-icon name="arrow-right" size="16" color="#ccc"></up-icon>
          </view>
        </view>

        <!-- <view class="qr-download">
          <text class="qr-download-title">扫码下载</text>
          <canvas canvas-id="downloadQR" class="download-qr-code"></canvas>
          <text class="qr-download-desc">使用手机浏览器扫描二维码</text>
        </view> -->
      </view>
    </SnPopup>
  </PageContainer>
</template>

<script setup>
import { ref, computed, onMounted, onUnmounted, nextTick } from "vue";
import PageContainer from "@/components/common/PageContainer.vue";
import SnPopup from "@/components/common/snPopup.vue";
import logoImg from "@/static/images/logo.png";
import { formatAmount, formatTime, showToast } from "@/utils/tools.js";
import { onLoad } from "@dcloudio/uni-app";

import BigNumber from "bignumber.js";

import { scanPayApi } from "@/api";

// 响应式数据
const remainingTime = ref(1800); // 30分钟倒计时
const isProcessingPayment = ref(false);
const showSuccessModal = ref(false);
const showTimeoutModal = ref(false);
const showDownloadModal = ref(false);
const orderAmount = ref("500.00");
const orderNumber = ref("");
const completedTime = ref("");
const countdownTimer = ref(null);
const orderDetail = ref(null);
const pollingTimer = ref(null);

// 计算属性
const formatCountdownTime = computed(() => {
  return (seconds) => {
    const mins = Math.floor(seconds / 60);
    const secs = seconds % 60;
    return `${mins.toString().padStart(2, "0")}:${secs
      .toString()
      .padStart(2, "0")}`;
  };
});

const getPaymentButtonText = computed(() => {
  if (remainingTime.value <= 0) return "支付已过期";
  if (isProcessingPayment.value) return "处理中...";
  return "KK钱包支付";
});

function getRandomColor() {
  const colors = [
    "#FF6B6B",
    "#4ECDC4",
    "#45B7D1",
    "#96CEB4",
    "#FECA57",
    "#FF9FF3",
    "#54A0FF",
  ];
  return colors[Math.floor(Math.random() * colors.length)];
}

function generateOrderNumber() {
  return `KK${Date.now()}${Math.floor(Math.random() * 1000)
    .toString()
    .padStart(3, "0")}`;
}

// 倒计时管理
const startCountdown = () => {
  countdownTimer.value = setInterval(() => {
    if (remainingTime.value > 0) {
      remainingTime.value--;
    } else {
      clearInterval(countdownTimer.value);
      showTimeoutModal.value = true;
    }
  }, 1000);
};

const stopCountdown = () => {
  if (countdownTimer.value) {
    clearInterval(countdownTimer.value);
    countdownTimer.value = null;
  }
};

// 轮询管理
const startPolling = () => {
  // 先清除可能存在的轮询
  stopPolling();
  // 立即执行一次
  getOrderDetail();
  // 设置轮询定时器，每3秒执行一次
  pollingTimer.value = setInterval(() => {
    getOrderDetail();
  }, 5000);
};

const stopPolling = () => {
  if (pollingTimer.value) {
    clearInterval(pollingTimer.value);
    pollingTimer.value = null;
  }
};

// 交互处理函数
const handleQRTap = () => {
  if (remainingTime.value <= 0) {
    showToast("支付已超时");
    return;
  }
};

const handleWalletPayment = async () => {
  if (remainingTime.value <= 0 || isProcessingPayment.value) return;
  isProcessingPayment.value = true;
  try {
    // 模拟支付处理
    await new Promise((resolve) => setTimeout(resolve, 3500));
    orderNumber.value = generateOrderNumber();
    completedTime.value = new Date().toLocaleString("zh-CN");
    stopCountdown();
    isProcessingPayment.value = false;
    showSuccessModal.value = true;
  } catch (error) {
    isProcessingPayment.value = false;
    showToast("支付失败，请重试");
  }
};

const handleDownloadWallet = () => {
  if (remainingTime.value <= 0) {
    showToast("订单已过期");
    return;
  }
  showDownloadModal.value = true;
};

const downloadForAndroid = () => {
  uni.showLoading({ title: "准备下载..." });
  setTimeout(() => {
    uni.hideLoading();
    showToast("Android版本下载完成", "success");
    showDownloadModal.value = false;
  }, 2000);
};

const downloadForIOS = () => {
  uni.showLoading({ title: "跳转App Store..." });
  setTimeout(() => {
    uni.hideLoading();
    showDownloadModal.value = false;
  }, 1500);
};

// 客服功能
const openCustomerService = () => {
  const url = "https://chat.333walp.com/";
  if (typeof plus !== "undefined") {
    plus.runtime.openURL(url);
  } else {
    // 对于非 App 平台，可以使用 window.location 或者其他方式
    window.location.href = url;
  }
  return;
};

// 模态框处理
const closeSuccessModal = () => {
  showSuccessModal.value = false;
  uni.navigateTo({
    url: `/pages/index/index`,
  });
};

const goBackHome = () => {
  showTimeoutModal.value = false;
  uni.navigateTo({
    url: `/pages/index/index`,
  });
};

const restartPayment = () => {
  showTimeoutModal.value = false;
  remainingTime.value = 1800;
  setTimeout(() => {
    startCountdown();
  }, 500);
};

const getOrderDetail = async () => {
  try {
    const res = await scanPayApi.getUserPurchaseOrderDetailApi({
      order_no: BigInt(orderNo.value),
    });
    if (res.code === 0) {
      orderDetail.value = res.data?.order_info;
      // 处理订单状态变化
      handleOrderStatusChange(res.data?.order_info);
    }
  } catch (error) {
    // showToast(error.desc || "获取订单详情失败", "error");
  }
};

// 处理订单状态变化
const handleOrderStatusChange = (data) => {
  // 根据订单状态执行相应操作
  // 示例：如果订单支付成功，显示成功弹窗
  if (data?.status === 2) {
    stopPolling();
    stopCountdown();
    // 设置订单信息
    completedTime.value = data.pay_time || new Date().toLocaleString("zh-CN");
    // 显示成功弹窗
    showSuccessModal.value = true;
  }
};

// 页面参数
const orderNo = ref("");

onLoad((options) => {
  if (options?.order_no) {
    orderNo.value = options.order_no;
    // 立即获取订单详情并启动轮询
    startPolling();
  }
});

// 生命周期
onMounted(() => {
  startCountdown();
});

onUnmounted(() => {
  stopCountdown();
  stopPolling();
});
</script>

<style lang="scss" scoped>
.payDetail-page {
  background-color: var(--bg-primary);

  padding-top: var(--status-bar-height);
}

.main-content {
  min-height: 100vh !important;
  padding: 40rpx 32rpx 60rpx;
  background: linear-gradient(
    135deg,
    #0077ff 0%,
    #0056d6 50%,
    #003db3 100%
  ) !important;
}

// Hero Section
.hero-section {
  display: flex;
  align-items: flex-start;
  margin-bottom: 60rpx;
  position: relative;
}

.phone-illustration {
  position: relative;
  margin-right: 40rpx;
}

.phone-mockup {
  width: 120rpx;
  height: 220rpx;
  background: linear-gradient(135deg, #2c2c2c, #4a4a4a);
  border-radius: 24rpx;
  padding: 12rpx;
  position: relative;
  box-shadow: 0 16rpx 40rpx rgba(0, 0, 0, 0.3);

  .phone-screen {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0077ff, #0056d6);
    border-radius: 16rpx;
    overflow: hidden;
    position: relative;
  }

  .screen-content {
    padding: 16rpx 12rpx;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16rpx;

    .status-left .time {
      font-size: 18rpx;
      color: #fff;
      font-weight: 600;
    }

    .status-right {
      display: flex;
      align-items: center;
      gap: 8rpx;

      .signal,
      .wifi,
      .battery {
        width: 16rpx;
        height: 8rpx;
        background: rgba(255, 255, 255, 0.8);
        border-radius: 2rpx;
      }

      .battery {
        position: relative;
        &::after {
          content: "";
          position: absolute;
          right: -4rpx;
          top: 2rpx;
          width: 2rpx;
          height: 4rpx;
          background: rgba(255, 255, 255, 0.8);
          border-radius: 0 2rpx 2rpx 0;
        }
      }
    }
  }

  .app-grid {
    .app-row {
      display: flex;
      justify-content: space-between;
      margin-bottom: 12rpx;

      .app-icon {
        width: 16rpx;
        height: 16rpx;
        border-radius: 4rpx;
        overflow: hidden;

        .icon-bg {
          width: 100%;
          height: 100%;
          opacity: 0.8;
        }
      }
    }
  }

  .bottom-banner {
    margin-top: auto;
    height: 40rpx;
    border-radius: 8rpx;
    overflow: hidden;
    background: linear-gradient(90deg, #0077ff, #00aaff);

    .banner-image {
      width: 100%;
      height: 100%;
    }
  }
}

.hero-text {
  flex: 1;
  padding-top: 20rpx;

  .main-title {
    display: block;
    font-size: 48rpx;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    margin-bottom: 16rpx;
    text-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.3);
  }

  .sub-title {
    display: block;
    font-size: 36rpx;
    font-weight: 500;
    color: #fff;
    margin-bottom: 12rpx;
    opacity: 0.9;
  }

  .description {
    display: block;
    font-size: 28rpx;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
  }
}

// 支付区域
.payment-area {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20rpx);
  border-radius: 40rpx;
  padding: 60rpx 40rpx;
  text-align: center;
  margin-bottom: 60rpx;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.2);
  .payment-amount {
    font-size: 36rpx;
    font-weight: 500;
    color: #fff;
    margin-bottom: 48rpx;
  }
}

.countdown-section {
  margin-bottom: 50rpx;

  .countdown-number {
    font-size: 120rpx;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 8rpx 16rpx rgba(0, 0, 0, 0.3);
    letter-spacing: 4rpx;

    &.urgent {
      color: #ff4757;
      animation: urgentPulse 1s ease-in-out infinite;
    }
  }
}

.qr-section {
  margin-bottom: 40rpx;

  .qr-container {
    position: relative;
    display: inline-block;
    background: #fff;
    padding: 40rpx;
    border-radius: 32rpx;
    box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;

    &:active {
      transform: scale(0.98);
    }

    &.loading {
      .qr-canvas {
        opacity: 0.3;
      }
    }

    .qr-canvas {
      width: 440rpx;
      height: 440rpx;
      border-radius: 16rpx;
      transition: opacity 0.6s ease;
    }

    .qr-loading {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 16rpx;

      .loading-text {
        font-size: 28rpx;
        color: #666;
      }
    }

    .qr-center-logo {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 96rpx;
      height: 96rpx;
      background: linear-gradient(135deg, #0077ff, #0056d6);
      border-radius: 20rpx;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 8rpx 24rpx rgba(0, 119, 255, 0.4);

      .logo-text {
        font-size: 32rpx;
        font-weight: 700;
        color: #fff;
        text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2);
      }
    }
  }
}

.payment-countdown {
  margin-bottom: 60rpx;

  .countdown-text {
    font-size: 32rpx;
    color: #fff;
  }

  .countdown-time {
    font-size: 40rpx;
    font-weight: 600;
    color: var(--error-color);
    margin: 0 8rpx;

    &.urgent {
      color: var(--error-color);
      animation: urgentPulse 1s ease-in-out infinite;
    }
  }
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 32rpx;

  .wallet-pay-btn,
  .download-btn {
    height: 96rpx;
    border-radius: 48rpx;
    font-size: 32rpx;
    font-weight: 600;
    border: none;
    transition: all 0.3s ease;
    box-shadow: 0 12rpx 32rpx rgba(0, 0, 0, 0.2);

    &:not(.expired):not(.processing) {
      background: linear-gradient(135deg, #0077ff, #0056d6);
    }

    &.processing {
      background: linear-gradient(135deg, #999, #bbb);
    }

    &.expired {
      background: #ccc;
      color: #999;
      cursor: not-allowed;
      box-shadow: none;
    }
  }

  .download-btn:not(.expired) {
    background: linear-gradient(135deg, #0099ff, #0077ff);
  }
}

// 客服区域
.customer-service {
  text-align: center;
  color: #fff;

  .service-title {
    display: block;
    font-size: 40rpx;
    font-weight: 600;
    margin-bottom: 24rpx;
    text-decoration: underline;
    cursor: pointer;
  }

  .advantages-title {
    display: block;
    font-size: 32rpx;
    margin-bottom: 32rpx;
    opacity: 0.9;
  }

  .advantage-item {
    display: block;
    font-size: 28rpx;
    line-height: 1.6;
    margin-bottom: 16rpx;
    opacity: 0.8;
    text-align: left;
  }
}

// 模态框样式
.success-modal {
  padding: 64rpx 48rpx;
  text-align: center;
  width: 640rpx;

  .success-animation {
    position: relative;
    margin-bottom: 48rpx;

    .success-icon {
      width: 160rpx;
      height: 160rpx;
      background: linear-gradient(135deg, #52c41a, #73d13d);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto;
      animation: successScale 0.6s ease-out;
    }

    .success-ripple {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 160rpx;
      height: 160rpx;
      border: 4rpx solid #52c41a;
      border-radius: 50%;
      animation: rippleEffect 2s ease-out infinite;
    }
  }

  .success-title {
    display: block;
    font-size: 44rpx;
    font-weight: 600;
    color: #333;
    margin-bottom: 16rpx;
  }

  .success-desc {
    display: block;
    font-size: 32rpx;
    color: #666;
    margin-bottom: 8rpx;
  }

  .success-detail {
    display: block;
    font-size: 28rpx;
    color: #999;
    margin-bottom: 48rpx;
    line-height: 1.4;
  }

  .order-info {
    background: #f8f9fa;
    border-radius: 24rpx;
    padding: 24rpx;
    margin-bottom: 48rpx;

    .info-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16rpx 0;

      &:not(:last-child) {
        border-bottom: 2rpx solid #e5e5e5;
      }

      .info-label {
        font-size: 28rpx;
        color: #666;
      }

      .info-value {
        font-size: 28rpx;
        color: #333;
        font-weight: 500;
      }
    }
  }

  .modal-actions {
    display: flex;
    gap: 24rpx;

    .detail-btn,
    .ok-btn {
      flex: 1;
      height: 88rpx;
      border-radius: 44rpx;
    }

    .detail-btn {
      background: #f0f0f0;
      color: #666;
    }
  }
}

.timeout-modal {
  padding: 64rpx 48rpx;
  text-align: center;

  .timeout-icon {
    margin-bottom: 40rpx;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .timeout-title {
    display: block;
    font-size: 40rpx;
    font-weight: 600;
    color: #333;
    margin-bottom: 16rpx;
  }

  .timeout-desc {
    display: block;
    font-size: 32rpx;
    color: #666;
    margin-bottom: 8rpx;
  }

  .timeout-detail {
    display: block;
    font-size: 28rpx;
    color: #999;
    margin-bottom: 48rpx;
    line-height: 1.4;
  }

  .timeout-actions {
    display: flex;
    gap: 24rpx;

    .back-btn,
    .retry-btn {
      flex: 1;
      height: 88rpx;
      border-radius: 44rpx;
    }

    .back-btn {
      background: #f0f0f0;
      color: #666;
    }
  }
}

.download-modal {
  padding: 48rpx;

  .download-header {
    text-align: center;
    margin-bottom: 48rpx;

    .download-title {
      display: block;
      font-size: 44rpx;
      font-weight: 600;
      color: #333;
      margin-bottom: 16rpx;
    }

    .download-subtitle {
      font-size: 28rpx;
      color: #666;
    }
  }

  .app-features {
    display: flex;
    justify-content: space-around;
    padding: 32rpx;
    background: #f8f9fa;
    border-radius: 24rpx;
    margin-bottom: 48rpx;

    .feature-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 16rpx;

      .feature-text {
        font-size: 24rpx;
        color: #666;
        text-align: center;
      }
    }
  }

  .download-platforms {
    margin-bottom: 48rpx;

    .platform-option {
      display: flex;
      align-items: center;
      padding: 32rpx;
      background: #f8f9fa;
      border-radius: 24rpx;
      margin-bottom: 24rpx;
      cursor: pointer;
      transition: background-color 0.2s;

      &:active {
        background: #e9ecef;
      }

      .platform-icon {
        margin-right: 24rpx;
      }

      .platform-info {
        flex: 1;

        .platform-name {
          display: block;
          font-size: 32rpx;
          color: #333;
          font-weight: 500;
          margin-bottom: 4rpx;
        }

        .platform-desc {
          font-size: 24rpx;
          color: #666;
        }
      }
    }
  }

  .qr-download {
    text-align: center;

    .qr-download-title {
      display: block;
      font-size: 32rpx;
      color: #333;
      margin-bottom: 24rpx;
    }

    .download-qr-code {
      width: 240rpx;
      height: 240rpx;
      border: 2rpx solid #e5e5e5;
      border-radius: 16rpx;
      margin-bottom: 16rpx;
    }

    .qr-download-desc {
      font-size: 24rpx;
      color: #999;
    }
  }
}

// 动画定义
@keyframes floatAndRotate {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-16rpx) rotate(90deg);
  }
  50% {
    transform: translateY(-8rpx) rotate(180deg);
  }
  75% {
    transform: translateY(-20rpx) rotate(270deg);
  }
}

@keyframes urgentPulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

@keyframes successScale {
  0% {
    transform: scale(0.5);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes rippleEffect {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
}

// 响应式设计
@media (max-width: 750rpx) {
  .hero-section {
    .hero-text {
      .main-title {
        font-size: 40rpx;
      }

      .sub-title {
        font-size: 32rpx;
      }
    }
  }

  .payment-area {
    padding: 48rpx 32rpx;

    .countdown-section .countdown-number {
      font-size: 100rpx;
    }

    .qr-container {
      padding: 32rpx;

      .qr-canvas {
        width: 360rpx;
        height: 360rpx;
      }

      .qr-center-logo {
        width: 80rpx;
        height: 80rpx;

        .logo-text {
          font-size: 28rpx;
        }
      }
    }
  }
}
</style>
